<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;

class CreateCommodityAttrTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('commodity_attr', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->integer('commodity_id')->comment('=commodities.id');            
            $table->string('attr_value')->default('')->comment('规格');
            $table->string('pick_code',64)->default('')->comment('拣货码')->unique();
            $table->string('bar_code')->default('')->comment('条形码');
            $table->integer('stock_num')->default(0)->comment('库存');
            $table->integer('is_deleted')->default(0)->comment('是否删除0正常1已删除');
            $table->timestamps();
        });

        DB::statement("ALTER TABLE `commodity_attr` comment '商品属性表';");

    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('commodity_attr');
    }
}
